<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('问题列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list" style="width: 742px; margin: 0 auto; padding-top: 10px;">
                    <ul>
                        <li>
                            <label class="col-sm-4 control-label" style="margin-top: 10px; padding-right: 0px;">问题类型：</label>
                            <div class="col-sm-8" style="padding-top: 3px; padding-left: 0;">
                                <select name="questionType" class="form-control" style="padding-top: 3px; padding-left: 0; ">
                                    <option value="">请选择</option>
                                    <option value="2">处理</option>
                                    <option value="3">解释</option>
                                </select>
                            </div>
                        </li>
                        <li>
                            <label class="col-sm-4 control-label" style="margin-top: 10px; padding-right: 0px;">问题版本号：</label>
                            <div class="col-sm-8" style="padding-top: 3px; padding-left: 0;">
                                <select name="questionVersion" class="form-control m-b" th:with="type=${@dict.getType('df_question_version')}" style="padding-top: 3px;">
                                    <option value="">请选择</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </div>
                        </li>
                        <li>
                            <!--<label class="col-sm-5 control-label">问题标题：</label>-->
                            <input type="text" name="questionTitle" style="width: 600px; margin-left: 13px;">
                        </li>
                        <li style="float: right; margin-top: -62px;">
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()" style="width: 100px;"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <!--<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <!--<div class="btn-group-sm" id="toolbar" role="group">-->
            <!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="question:dfQuestion:add">-->
                <!--<i class="fa fa-plus"></i> 添加-->
            <!--</a>-->
            <!--<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="question:dfQuestion:edit">-->
                <!--<i class="fa fa-edit"></i> 修改-->
            <!--</a>-->
            <!--<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="question:dfQuestion:remove">-->
                <!--<i class="fa fa-remove"></i> 删除-->
            <!--</a>-->
            <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="question:dfQuestion:export">-->
                <!--<i class="fa fa-download"></i> 导出-->
            <!--</a>-->
        <!--</div>-->
        <div class="col-sm-12 select-table table-striped">
            <h2>待处理列表</h2>
            <table id="bootstrap-table" data-mobile-responsive="true"></table>

            <h2>已处理列表</h2>
            <table id="approveRecordTable" data-mobile-responsive="true"></table>

        </div>


    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('question:dfQuestion:edit')}]];
    var removeFlag = [[${@permission.hasPermi('question:dfQuestion:remove')}]];
    var prefix = ctx + "question/dfApprove";

    var states = [[${@dict.getType('df_question_state')}]];
    var types = [[${@dict.getType('df_question_type')}]];
    var versions = [[${@dict.getType('df_question_version')}]];
    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "问题",
            showExport: false,
            order:"desc",
            columns: [
                {
                    field : 'id',
                    title : '',
                    visible: false
                },
                {
                    field : 'questionNumber',
                    title : '问题编号',
                    sortable: true
                },
                {
                    field : 'questionTitle',
                    title : '问题',
                    sortable: true
                },
                {
                    field : 'createtime',
                    title : '创建时间',
                    sortable: true
                },
                {
                    field : 'userName',
                    title : '用户名称',
                    sortable: true
                },
                {
                    field : 'questionVersion',
                    title : '问题版本',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(versions, value);
                    }
                },
                {
                    field : 'userDept',
                    title : '用户单位',
                    sortable: true
                },
                {
                    field : 'questionType',
                    title : '问题类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(types, value);
                    }
                },
                {
                    field : 'updatetime',
                    title : '解决时间',
                    sortable: true
                },
                {
                    field : 'questionState',
                    title : '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(states, value);
                    }
                },

                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="checkapprove(\'' + row.id + '\')"><i class="fa fa-check"></i>处理</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="questionSchedule('+row.id+')"><i class="fa fa-eye"></i>进度</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);


        //已审核列表 初始化
        var $table = $('#approveRecordTable');

        $table.bootstrapTable({
            contentType: "application/x-www-form-urlencoded",
            method:"post",
            showRefresh : false,
            showToggle: false,
            showColumns:false,
            pagination:true,
            idField : "id",
            sortName : 'id',
            sortOrder : 'desc',
            pageSize: 5,
            queryParamsType:"",
            queryParams:function(params) {
                //将查询条件添加到查询参数中，分页或者刷新时将携带这些参数
                params["pageNum"] = params.pageNumber;
                params["pageSize"] = params.pageSize;
                params["sortOrder"]=params.sortOrder;
                params["sortName"]=params.sortName;
                return params;
            },
            sidePagination : "server",
            url : prefix+"/examineList",
            columns: [
                {
                    field : 'id',
                    title : '',
                    visible: false
                },
                {
                    field : 'questionNumber',
                    title : '问题编号',
                    sortable: true
                },
                {
                    field : 'questionTitle',
                    title : '问题',
                    sortable: true
                },
                {
                    field : 'createtime',
                    title : '创建时间',
                    sortable: true
                },
                {
                    field : 'userName',
                    title : '用户名称',
                    sortable: true
                },
                {
                    field : 'questionVersion',
                    title : '问题版本',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(versions, value);
                    }
                },
                {
                    field : 'userDept',
                    title : '用户单位',
                    sortable: true
                },
                {
                    field : 'questionType',
                    title : '问题类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(types, value);
                    }
                },
                {
                    field : 'updatetime',
                    title : '解决时间',
                    sortable: true
                },
                {
                    field : 'questionState',
                    title : '状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(states, value);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        //console.log(row.id);
                        actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)"  onclick="look(\'' + row.id + '\')"><i class="fa fa-search"></i>查看</a> ');
                        //actions.push('<a class="btn btn-success btn-xs" href="#"  onclick="toSecEdit(\'' + row.articeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="questionSchedule('+row.id+')"><i class="fa fa-eye"></i>进度</a> ');
                        return actions.join('');
                    }
                }
            ]
        });
    });
    function look(id) {
        $.modal.look("查看问题",prefix+"/view/"+id);
    }
    function checkapprove(id) {
        $.modal.look("处理问题",prefix+"/edit/"+id);
    }
    //查看问题进度
    function questionSchedule(id){
        $.modal.look("查看问题进度",ctx + "question/dfQuestion/checkSchedule/"+id,825);
    }
</script>
</body>
</html>